<?php
/**
 * Created by PhpStorm.
 * User: LuLingFeng
 * Date: 2018/3/1
 * Time: 17:29
 */
namespace App\Http\Admin\Personnel\Controllers;

use App\Eloquent\Oa\Log\Leave;
use App\Http\Admin\Personnel\Models\AttendanceFactor;
use Framework\BaseClass\Http\Admin\Controller;

class AttendanceFactorController extends Controller
{
    public function leaveLog()
    {
        $params = $this->getRequestParameters(['oa_contacts_id', 'start_time', 'end_time']);
        $paging = $this->getPagingRequestParameters();
        $manager = new AttendanceFactor();
        $data = $manager->commonList(Leave::with([]), [
            'oa_contacts_id' => $params['oa_contacts_id'],
            'start_time'     => $params['start_time'],
            'end_time'       => $params['end_time']
        ], $paging);
        foreach ($data['list'] as $item) {
            $item['start_time_str'] = date('Y-m-d H:m:i', $item['start_time']);
            $item['end_time_str'] = date('Y-m-d H:m:i', $item['end_time']);
        }
        return $data;
    }
}